package com.wanxi.web.service.user.impl;

import com.wanxi.login.api.LoginFeign;
import com.wanxi.login.domain.dto.LoginDefaultDto;
import com.wanxi.login.domain.result.LoginResult;
import com.wanxi.user.api.UserFeign;
import com.wanxi.user.domain.entity.UserInfo;
import com.wanxi.user.domain.query.UserQuery;
import com.wanxi.user.domain.result.UserResult;
import com.wanxi.web.service.user.UserWebService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * ClassName: UserWebService
 * Description:
 * date: 2022/1/13 11:07
 *
 * @author lxl
 * @version 1.0
 * @since JDK 1.8
 */
@Service
public class UserWebServiceImpl implements UserWebService {

    @Resource
    private UserFeign userFeign;

    @Resource
    private LoginFeign loginFeign;

    @Override
    public UserResult<List<UserInfo>> findAll(UserQuery userQuery) {
        return userFeign.findAll(userQuery);
    }

    @Override
    public UserResult<String> updateDefaultId(LoginDefaultDto loginDefaultDto) {

        LoginResult<Boolean> booleanLoginResult = loginFeign.updateDefaultId(loginDefaultDto);
        if (booleanLoginResult.getData()){
            return  UserResult.success("修改成功");
        }
        return  UserResult.failed("修改失败");
    }

}
